
package com.choosefine.it.basedata.service;

import com.choosefine.it.basedata.dao.CityMapper;
import com.choosefine.it.basedata.model.City;
import com.choosefine.it.basedata.model.ProvinceAndCity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 城市service
 * @author guwenwei
 *
 */
@Service
public class CityService {

    @Autowired
    private CityMapper cityMapper;

    public List<City> getCitysByFather(String father) {
        return cityMapper.selectCitysByFather(father);
    }

    public void save(City country) {
        if (country.getId() != null) {
            cityMapper.updateByPrimaryKey(country);
        } else {
            cityMapper.insert(country);
        }
    }
	public int deleteByPrimaryKey(Integer id) {
		
		return cityMapper.deleteByPrimaryKey(id);
	}

	public City findByPrimaryKey(Integer id) {
		
		return cityMapper.selectByPrimaryKey(id);
	}

	public List<City> selectAll() {
		
		return cityMapper.selectAll();
	}

	public City selectByCtiyID(String cityid) {
		return cityMapper.selectByCityID(cityid);
	}

    public List<ProvinceAndCity> getAllProvinceAndCity() {
        return cityMapper.getAllProvinceAndCity();
    }
}
